package com.aaa.controller;

import com.aaa.util.UploadUtil;
import com.aaa.vo.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description:nnwoidaowdjoahwifusehfkjszhbfklsuiefhbszjlhbenflkjsz
 * @author:LiWei
 * @date:2022年09月26日14:19
 */
@Controller
public class UploadController {
    @RequestMapping("/upload")
    public String upload(MultipartFile file, HttpServletRequest request) throws Exception{
        String upload= UploadUtil.upload(file,request);
        return "index.jsp";
    }

    @RequestMapping("/upload1")
    @ResponseBody
    public Result upload1(MultipartFile file, HttpServletRequest request)throws Exception{
        String path=UploadUtil.ossUpload(file);
        return new Result(200,"成功",path);
    }
}
